import { defineStore } from 'pinia'

export default defineStore('userInfo', {
  state: () => ({
    userInfo: null
  }),
  actions: {
    setUserInfo(userInfo) {
      this.userInfo = userInfo
      localStorage.setItem('userInfo', JSON.stringify(userInfo))
    }
  },
  getters: {
    userId() {
      return this.userInfo?.userId
    }
  }
})
